#include "ConstTable.h"
#include <iostream>
using namespace std;
	
ConstTable::ConstTable(){}
	
	int ConstTable::getSize(){
		return table.size();
	}

	int ConstTable::getConstant(int index){
		return table.at(index).getConstant();
	}
	int ConstTable::getIndex(int constant){
		ConstDataRow toCheck;
		int index = -1;
		int j = table.size();
		for(int i = 0; i < j; i++){
			toCheck = table.at(i);
			if(toCheck.getConstant() == constant){
				index = i;
				break;
			}
		}
		return index;
	}
	int ConstTable::insertData(int constant){
		ConstDataRow data;int index = -1;
		if (table.empty() == false){
			index = getIndex(constant);
		}
		if(index == -1){
			data.setConstant(constant);
			table.push_back(data);
			index = table.size();
	}
		return index;
	};